package operation;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

public class ReturnOperation implements IOPeration {
    public void work(BookList bookList) {
        System.out.println("归还图书");
        Scanner sc = new Scanner(System.in);
        String name = sc.nextLine();
        int current = bookList.getUsedSize();
        int i = 0;
        for (; i < current; i++) {
            Book book = bookList.getPos(i);
            if (book.getName().equals(name)) {

                book.setBorrowed(false);
                System.out.println("归还成功");
                return;
            }
        }
    }
}
